<?php

/*
**	Create or Edit Post
**	Form to create or edit a post.
**
**	- Form is disabled if administrator is not logged in.
*/

if (!in_array($this->session->userdata('current_user_screen_name'), $this->config->item('admins', 'ligature'))) {
    redirect('/');
}

$data['applicationTitle'] = $this->lang->line('ligature_title');;
$data['pageTitle'] = $this->lang->line('ligature_editPost_title');
$data['pageId'] = 'editPost';

$data['message'] = $this->session->flashdata('message');

if (!is_null($postId)) {
    $post = $this->Ligature_Post_model->readPost($postId);
    $data['post'] = $post;
} else {
    $data['post'] = new Post();
}

$data['currentUserName'] = $this->session->userdata('current_user_name');

$this->load->view($this->config->item('theme', 'ligature') . '/header', $data);
$this->load->view($this->config->item('theme', 'ligature') . '/editpost', $data);
$this->load->view($this->config->item('theme', 'ligature') . '/footer', $data);

/* clickframes::version=1078804602::clickframes */
?>
